//
//  Pizza.m
//  Pizza
//
//  Created by ghwang on 15/3/28.
//  Copyright (c) 2015年 sendInfo. All rights reserved.
//

#import "Pizza.h"
#import "OrderM.h"

@implementation Member

CONVERT_PROPERTY_CLASS(address, Address)

@end

@implementation Friend

@end

@implementation Shop
@end

@implementation ShopGrade

@end
@implementation MyStyle

@end
@implementation Status
@end

@implementation Goods
@end

@implementation News
@end

@implementation Address
@end
@implementation OrderGoods

@end
@implementation Order

CONVERT_PROPERTY_CLASS(products,OrderGoods)
@end

@implementation PayType
@end

////////////////////////////////////////////////////////////////////////

@implementation HttpAPI

DEF_MESSAGE_(REGISTER,msg)
{

    
    if (msg.sending) {

        NSString *url = [NSString stringWithFormat:@"%@/register.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
    
        NSDictionary *result = msg.responseJSONDictionary;
        NSLog(@"result====%@",result);
        Status *sta = [Status objectFromDictionary:result];
        msg.OUTPUT(@"status",sta);
        
    
    }else if (msg.failed)
    {
    
    
    }


}

DEF_MESSAGE_(LOGIN, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/login.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *status= [Status objectFromDictionary:result];
        NSLog(@"result====%@",msg.responseString);

        msg.OUTPUT(@"status",status);
        if ([status.code intValue] != 10000) {
           
            Status *sta = [Status objectFromDictionary:result];
            msg.OUTPUT(@"status",sta);
            
            
        }else{
        
            [[SendIFAPPDefault shareAppDefault] setLoginName:[result[@"resultCode"] objectForKey:@"name"]];
            [[SendIFAPPDefault shareAppDefault] setUserImgurl:[result[@"resultCode"] objectForKey:@"imgUrl"]];
            [[SendIFAPPDefault shareAppDefault] setMobile:[result[@"resultCode"] objectForKey:@"mobile"]];
            [[SendIFAPPDefault shareAppDefault] setUserToken:result[@"token"]];
            [[SendIFAPPDefault shareAppDefault] setLoginState:@"1"];
            [[SendIFAPPDefault shareAppDefault] setCurrentUserID:[result[@"resultCode"] objectForKey:@"id"]];
            
        
        }
        
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(GET_VERCODE,msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/getcode.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        NSLog(@"result====%@",result);
        Status *sta = [Status objectFromDictionary:result];
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(GETHOME, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/home.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *status= [Status objectFromDictionary:result];
        NSLog(@"result====%@",msg.responseString);
        if ([status.code intValue] == 20000) {
            msg.failed = YES;
            msg.OUTPUT(@"message",status.message);
            return;
        }
        NSArray *shops = [Shop objectsFromArray:result[@"shops"]];
        Member *mer = [Member objectFromDictionary:result[@"member"] ];
        Shop *myshop = [Shop objectFromDictionary:result[@"myshop"]];
        msg.OUTPUT(@"shops",shops);
        msg.OUTPUT(@"member",mer);
        msg.OUTPUT(@"myshop",myshop);
        msg.OUTPUT(@"flag",result[@"flag"]);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(UPDATETOKEN, msg)
{

        if (msg.sending) {
            
            
            NSString *url = [NSString stringWithFormat:@"%@/update_token.php",[HttpRequest sharedInstance].url];
            NSDictionary *dic = msg.GET_INPUT(@"body");
            msg.HTTP_POST(url).PARAM(dic);
            
        }else if (msg.succeed)
        {
            
            NSDictionary *result = msg.responseJSONDictionary;
            NSLog(@"result====%@",result);
            Status *sta = [Status objectFromDictionary:result];
            msg.OUTPUT(@"status",sta);
            msg.OUTPUT(@"token",result[@"resultCode"]);
            
            
        }else if (msg.failed)
        {
            
        }

}

DEF_MESSAGE_(LOGOUT, msg)
{
    
    
    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/logout.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        Status *sta = [Status objectFromDictionary:msg.responseJSONDictionary];
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }

}



DEF_MESSAGE_(resetpassword, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/resetpassword.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        Status *sta = [Status objectFromDictionary:msg.responseJSONDictionary];
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(randomcode, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/randomcode.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        NSDictionary *resultDic = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:resultDic];
        if ([sta.code intValue] == 20000) {
            
            msg.failed = YES;
            return;
        }
        msg.OUTPUT(@"randcode",resultDic[@"randomCode"]);
        msg.OUTPUT(@"token",resultDic[@"token"]);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(validate, msg)
{


    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/validate.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(shop_home, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/shop_home.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
       
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        Shop *sp = [Shop objectFromDictionary:result[@"shop"]];
        if ([sta.code intValue] == 20000) {
            
            msg.failed = YES;
            return;
        }
        msg.OUTPUT(@"shop",sp);
        msg.OUTPUT(@"status",sta);
        
        
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(shop_search, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/shop_search.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        NSArray *sps = [Shop objectsFromArray:result[@"shops"]];
        msg.OUTPUT(@"shops",sps);
        
        
    }else if (msg.failed)
    {
        
        
    }


}

DEF_MESSAGE_(shops, msg)
{

    if (msg.sending) {

        NSString *url = [NSString stringWithFormat:@"%@/shops.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
        
    }else if (msg.succeed)
    {

        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        NSArray *shops = [Shop objectsFromArray:result[@"shops"]];
        
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"shops",shops);
        msg.OUTPUT(@"totalNumber",result[@"totalNumber"]);
    
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(products, msg)
{


    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/products.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        
        NSDictionary *resultD = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:resultD];
        if ([sta.code intValue] != 10000) {
            
            msg.failed = YES;
            
            return;
        }
        
        
        NSArray *goods = [Goods objectsFromArray:resultD[@"products"]];
        msg.OUTPUT(@"goods",goods);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"totallNum",resultD[@"totalNumber"]);
        
        
    }else if (msg.failed)
    {
        
        
    }


}

DEF_MESSAGE_(notice, msg)
{


    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/notice.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *status= [Status objectFromDictionary:result];
        NSLog(@"result====%@",msg.responseString);
        if ([status.code intValue] == 20000) {
            msg.failed = YES;
            msg.OUTPUT(@"message",status.message);
            return;
        }
        NSArray *news = [News objectsFromArray:result[@"resultCode"]];
        msg.OUTPUT(@"news",news);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(notice_detail, msg)
{


    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/notice_detail.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *status= [Status objectFromDictionary:result];
        NSLog(@"result====%@",msg.responseString);
        if ([status.code intValue] == 20000) {
            msg.failed = YES;
            msg.OUTPUT(@"message",status.message);
            return;
        }
        msg.OUTPUT(@"content",[result[@"resultCode"] objectForKey:@"content"]);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(address, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/address.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        NSDictionary *dic = msg.responseJSONDictionary;
        NSArray *arrs = [Address objectsFromArray:dic[@"resultCode"]];
        Status *sta = [Status objectFromDictionary:dic];
        msg.OUTPUT(@"address",arrs);
        msg.OUTPUT(@"status",sta);
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(address_add, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/address_add.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        Status *sta = [Status objectFromDictionary:msg.responseJSONDictionary];
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
    }

}

DEF_MESSAGE_(address_del, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/address_del.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(address_update, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/address_update.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        msg.OUTPUT(@"status",[Status objectFromDictionary:msg.responseJSONDictionary]);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(current_order, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/current_order.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        
        NSDictionary *dic = msg.responseJSONDictionary;
        NSArray *ordms = [Order objectsFromArray:dic[@"resultCode"]];
        msg.OUTPUT(@"orders",ordms);
        msg.OUTPUT(@"status",[Status objectFromDictionary:dic]);
        
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(history_order, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/history_order.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSString *result = msg.responseString;
        NSLog(@"result====%@",result);
        
        NSDictionary *dic = msg.responseJSONDictionary;
        NSArray *ordms = [Order objectsFromArray:dic[@"resultCode"]];
        msg.OUTPUT(@"orders",ordms);
        msg.OUTPUT(@"status",[Status objectFromDictionary:dic]);
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(order_checkout, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/order_checkout.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        NSArray *pays = [PayType objectsFromArray:result[@"avaliablePaymentWays"]];
        msg.OUTPUT(@"pays",pays);
        msg.OUTPUT(@"fee",result[@"deliverFee"]);
     
        
        
    }else if (msg.failed)
    {
        
        
    }


}

DEF_MESSAGE_(order_detail, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/order_detail.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        Order *order = [Order objectFromDictionary:result[@"resultCode"]];
        msg.OUTPUT(@"order",order);
        
        
    }else if (msg.failed)
    {
        
        
    }


}

DEF_MESSAGE_(order_add, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/order_add.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"orderId",result[@"orderId"]);
        
        
    }else if (msg.failed)
    {
        
        
    }


}

DEF_MESSAGE_(box_reg, msg)
{

    
    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/box_reg.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }



}
DEF_MESSAGE_(shop_link, msg)
{

    
    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/shop_link.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"shopsDic",result[@"resultCode"]);
        
        
    }else if (msg.failed)
    {
        
        
    }



}
DEF_MESSAGE_(box_login, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/box_login.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        if ([sta.code intValue]!=10000) {
            
            msg.failed = YES;
            msg.OUTPUT(@"status",sta);
            return;
        }
       
        
        NSDictionary *footerd = @{@"totalNumber":result[@"totalNumber"],@"totalProfits":result[@"totalProfits"],@"availableMoney":result[@"availableMoney"],@"moneyAccount":result[@"moneyAccount"]};
        msg.OUTPUT(@"mystore",result[@"mystoreProfits"]);
        msg.OUTPUT(@"stores",@[result[@"mystoreProfits"],result[@"link_shop1"]?:@{},result[@"link_shop2"]?:@{},result[@"link_shop3"]?:@{},result[@"link_shop4"]?:@{},result[@"link_shop5"]?:@{}]);
        msg.OUTPUT(@"footerData",footerd);
        msg.OUTPUT(@"status",sta);
        
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(member_info, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/member_info.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        Member *mem = [Member objectFromDictionary:result];
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"memberinfo",mem);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(member_update, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/member_update.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic).FILE_PNG(@"pic.png",[msg.GET_INPUT(@"body") objectForKey:@"pic"]);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }

}
DEF_MESSAGE_(friend_invite, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/friend_invite.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"inviteUrl",result[@"inviteUrl"]);
        
        
    }else if (msg.failed)
    {
        
        
    }

}

DEF_MESSAGE_(friend_add, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/friend_add.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(friend_list, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/friend_list.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        NSArray *fris = [Friend objectsFromArray:result[@"resultCode"]];
        msg.OUTPUT(@"friends",fris);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(style, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/style.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        NSArray *mystys = [MyStyle objectsFromArray:result[@"resultCode"]];
        msg.OUTPUT(@"mystyles",mystys);
        msg.OUTPUT(@"styleid",result[@"styleId"]);
        
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(shop_grade, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/shop_grade.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        NSArray *grades = [ShopGrade objectsFromArray:result[@"resultCode"]];
        msg.OUTPUT(@"grades",grades);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(style_update, msg)
{
    
    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/style_update.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
        
    }else if (msg.failed)
    {
        
        
    }
    
    
}


DEF_MESSAGE_(style_history, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/style_history.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        NSArray *mystys = [MyStyle objectsFromArray:result[@"resultCode"]];
        msg.OUTPUT(@"mystyles",mystys);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(alipay, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/alipay.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"rsa",result[@"resultCode"]);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(cash, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/cash.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(money_account, msg)
{

    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/money_account.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_POST(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        
        
    }else if (msg.failed)
    {
        
        
    }


}
DEF_MESSAGE_(aboutus, msg)
{
    
    if (msg.sending) {
        
        
        NSString *url = [NSString stringWithFormat:@"%@/aboutus.php",[HttpRequest sharedInstance].url];
        NSDictionary *dic = msg.GET_INPUT(@"body");
        msg.HTTP_GET(url).PARAM(dic);
        
    }else if (msg.succeed)
    {
        
        NSDictionary *result = msg.responseJSONDictionary;
        Status *sta = [Status objectFromDictionary:result];
        BeeLog(@"result====%@",msg.responseString);
        msg.OUTPUT(@"status",sta);
        msg.OUTPUT(@"info",result);
        
        
    }else if (msg.failed)
    {
        
        
    }
    
    
}
@end

/**
 *  配置请求路径，图片路径，以单利形式
 */
@implementation HttpRequest

DEF_SINGLETON(HttpRequest)

//http://112.126.80.201
- (NSString *)url
{
    NSString *pizzaUrl = @"http://112.126.80.201/service";
    return pizzaUrl;


}
- (NSString *)imageUrl
{
    NSString *pizzaUrl = @"http://112.126.80.201";
    return pizzaUrl;
}
@end